
//
//  TicketNavgationController.m
//  majia
//
//  Created by 红嘴欧 on 2018/9/4.
//  Copyright © 2018年 Anhui hongzuo information technology co. LTD. All rights reserved.
//

#import "TicketNavgationController.h"

@interface TicketNavgationController () <UIGestureRecognizerDelegate, UINavigationControllerDelegate>

@end

@implementation TicketNavgationController


+ (void)initialize {
    
    UINavigationBar *navBar = [UINavigationBar appearance];
    navBar.titleTextAttributes = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:18], NSFontAttributeName, NSForegroundColorAttributeName, UIColor.blueColor, nil];
}


- (void)viewDidLoad {
    [super viewDidLoad];
    if ([self respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
        self.interactivePopGestureRecognizer.delegate = self;
    }
//    self.delegate = self;
}


- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
    if (self.viewControllers.count > 0) {
//        UIImage *oriImage = [[UIImage imageNamed:@"fh"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
        viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage: [UIImage imageNamed:@"fh"] style:UIBarButtonItemStylePlain target:self action:@selector(backAction)];
        viewController.hidesBottomBarWhenPushed = YES;
    }
    [super pushViewController:viewController animated:YES];
}

- (void)showViewController:(UIViewController *)vc sender:(id)sender {
    BOOL state = (self.viewControllers.count==1)?YES:NO;
    self.interactivePopGestureRecognizer.enabled = state;
}

- (void)backAction {
    [self popViewControllerAnimated:YES];
}

@end
